--[[/**
-- * 

 * 队友死亡时,队友死光了的话, 自己如果也是死亡中,则真的死去
-- */]]

---@class BuffEffect613103 : BaseBuffEffect
BuffEffect613103 = ClientFight.CreateClass("BuffEffect613103", ClientFight.BaseBuffEffect)
local t = BuffEffect613103

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = { ... };
    local b = table.contains(buff.target.totalSign.signs, buff.buffBean.f_BuffEffectValue[1]);
    if (not b) then
        return IBuffEffect.FAIL;
    end
    --判断下是否还有队友存活
    local fighters = buff.target.fightTeam.fighters;
    local hasTeamMem = false;
    for k, fighter in pairs(fighters) do
        local flag = true;
        if (fighter:isDie()) then
            flag = false;
        end
        if (fighter:isSummons() or fighter.summonsCreater ~= nil) then
            flag = false;
        end
        if (fighter == buff.target) then
            flag = false;
        end
        if (fighter == buff.target.puppet) then
            flag = false;
        end
        if flag then
            hasTeamMem = true;
            break ;
        end
    end
    if (hasTeamMem) then
        return IBuffEffect.FAIL;
    end
    local list = buff.target.fightTeam.alternates;
    if (not table.getn(list) == 0) then
        return IBuffEffect.FAIL;
    end
    SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterIds .. " Buff"
            .. buff.modelId .. " 队友死光了, 西泽也正好处于死亡复活状态中, 西泽直接死去吧");
    FighterManager.die(fight, buff.target, nil, FighterDieType.NORMAL);
    FighterManager.removeAllBuff(fight, buff.target);
    return IBuffEffect.FAIL;
end

t.New()